﻿using QG.FrontDesk.BLL.IService;
using QG.FrontDesk.DAL.IRepository;
using QG.FrontDesk.Model;
using System;
using System.Collections.Generic;

namespace QG.FrontDesk.BLL.Service
{
    public class PositionSubscService: IPositionSubscService
    {
        private IPositionSubscRepository _positionSubscRepository;
        public PositionSubscService(IPositionSubscRepository positionSubscRepository)
        {
            this._positionSubscRepository = positionSubscRepository;
        }

        /// <summary>
        /// 职位订阅——获取职位名称
        /// </summary>
        /// <returns></returns>
        public List<Classifyinfo> GetClassify()
        {
            return _positionSubscRepository.GetClassify();
        }        

        /// <summary>
        /// 职位订阅——获取所有职位名称
        /// </summary>
        /// <returns></returns>
        public List<PostName> GetPostName()
        {
            return _positionSubscRepository.GetPostName();
        }
               
        /// <summary>
        /// 职位订阅——新增一条职位订阅记录
        /// </summary>
        /// <param name="positionSubscribe"></param>
        /// <returns></returns>
        public bool AddPositionSubscribe(PositionSubscribe positionSubscribe)
        {
            positionSubscribe.Time = DateTime.Now;
            return _positionSubscRepository.AddPositionSubscribe(positionSubscribe);
        }
        /// <summary>
        /// 新增职位
        /// </summary>
        /// <param name="positionInfo"></param>
        /// <param name="postName"></param>
        /// <returns></returns>
        public int AddPosition(PositionInfo positionInfo, PostName postName)
        {
            positionInfo.PublishTime = DateTime.Now;
            return _positionSubscRepository.AddPosition(positionInfo,postName);
        }

        /// <summary>
        /// 得到对应的职位信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public PositionInfo GetPositionInfo(int Id, int UserId) {
            return _positionSubscRepository.GetPositionInfo(Id,UserId);
        }


        /// <summary>
        /// 收藏职位——新增一条收藏职位表记录
        /// </summary>
        /// <param name="collectPost">收藏职位表</param>
        /// <returns></returns>
        public bool AddCollection(CollectPost collectPost)
        {
            return _positionSubscRepository.AddCollection(collectPost);
        }

        /// <summary>
        /// 收藏职位——取消收藏
        /// </summary>
        /// <param name="collectPost"></param>
        /// <returns></returns>
        public bool DelectCollection(CollectPost collectPost)
        {
            return _positionSubscRepository.DelCollection(collectPost);
        }

        /// <summary>
        /// 收藏职位——展示收藏职位信息
        /// </summary>
        /// <param name="cpId"></param>
        /// <returns></returns>
        public List<CollectPost> GetCollectPost(int userId)
        {
            return _positionSubscRepository.GetCollectPost(userId);
        }


    }
}
